package com.example.mountainwalker.mapper;

import com.example.mountainwalker.entity.TravelStrategyInfo;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface TravelStrategyMapper {

    @Select("SELECT * FROM mw.travelstrategy")
    List<TravelStrategyInfo> getTravelStrategyInfo();

    @Select("select * from mw.travelstrategy where StrategyID= #{StrategyID}")
    TravelStrategyInfo getTravelStrategyInfoById(Integer StrategyID);

    @Delete("delete from mw.travelstrategy where StrategyID= #{StrategyID}")
    int deleteTravelStrategyInfoById(Integer StrategyID);

    @Insert("insert into mw.travelstrategy (StrategyID, StrategyName,RegionID,UserID,ScenicSpotID,GroupTourID,StrategyContent,ModificationTime) " +
            "values(#{StrategyID}, #{StrategyName}, #{RegionID}, #{UserID}, #{ScenicSpotID}, #{GroupTourID}, #{StrategyContent}, #{ModificationTime})")
    int insertTravelStrategyInfo(TravelStrategyInfo travelStrategyInfo);

    @Update("update mw.travelstrategy set " +
            "StrategyName=#{StrategyName}, " +
            "RegionID=#{RegionID}, " +
            "UserID=#{UserID}, " +
            "ScenicSpotID=#{ScenicSpotID}, " +
            "GroupTourID=#{GroupTourID}, " +
            "StrategyContent=#{StrategyContent}," +
            "ModificationTime=#{ModificationTime}"+
            "WHERE StrategyID=#{StrategyID}")
    int updateTravelStrategyInfo(TravelStrategyInfo travelStrategyInfo);
}
